-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add Subscription base class on app instance #3058
Conversation
估计之前没有人用 class 写过 schedule |
Codecov Report
@@ Coverage Diff @@
## master #3058 +/- ##
==========================================
+ Coverage 99.75% 99.75% +<.01%
==========================================
Files 29 29
Lines 829 830 +1
==========================================
+ Hits 827 828 +1
Misses 2 2
Continue to review full report at Codecov.
|
有的吧,都直接 require 的 |
'use strict'; | ||
|
||
module.exports = app => { | ||
return class LoggerExample extends app.Subscription { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
说个题外的,我倒是挺想加个 app.Schedule 的,而不是让定时任务直接继承基类 Subscription
不过插件里面好像没法挂。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么还要多一个 Schedule 呢?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Schedule 就像 Controller 这样的基类。
Subscription 不是 Schedule 专用的。
应用层可以 require,但是插件只能通过 app 获取。 |
目前 class 的方式用起来有点别扭 |
feat: add Subscription base class on app instance (#3058)
Checklist
npm test
passesAffected core subsystem(s)
Description of change